<template>
  <view class="container">
    <image class="bg" src="/static/images/bg.png" mode="widthFix"></image>
    <view class="header">
      <view class="name">你好，张三三</view>
      <view class="time">截止:2024年05月22日 18时46分15秒</view>
    </view>

    <view class="dataBox">
      <image
        class="dataBox-bg"
        src="/static/images/home-dataBox.png"
        mode="widthFix"
      ></image>
      <view class="dataBox-content">
        <view class="header">
          <view class="value">12,999,999.00</view>
          <view class="label">本月团队交易额(万元)</view>
        </view>
        <view class="bottom">
          <view class="item text-align-left">
            <view class="value">0</view>
            <view class="label">今日激活商户</view>
          </view>
          <view class="item text-align-center">
            <view class="value">456,574.21</view>
            <view class="label">今日团队交易(元)</view>
          </view>
          <view class="item text-align-right">
            <view class="value" style="text-align: right">51</view>
            <view class="label">今日新增服务商</view>
          </view>
        </view>
      </view>
    </view>

    <view class="navBox">
      <view class="item" @click="navigateTo('/pages/home/myMerchant')">
        <image
          class="navBox-bg"
          src="/static/images/icon-shgl.png"
          mode="heightFix"
        ></image>
        <view class="content">
          <view class="label">商户管理</view>
          <view class="value">一键查看我的库存</view>
        </view>
      </view>

      <view class="item" @click="navigateTo('/pages/home/myServiceProvider')">
        <image
          class="navBox-bg"
          src="/static/images/icon-tdgl.png"
          mode="heightFix"
        ></image>
        <view class="content">
          <view class="label">团队管理</view>
          <view class="value">一键查看我的团队</view>
        </view>
      </view>

      <view class="item" @click="navigateTo('/pages/home/inventoryManagement')">
        <image
          class="navBox-bg"
          src="/static/images/icon-zdgl.png"
          mode="heightFix"
        ></image>
        <view class="content">
          <view class="label">终端管理</view>
          <view class="value">一键查看我的终端</view>
        </view>
      </view>

      <view class="item" @click="navigateTo('/pages/home/merchantNetwork')">
        <image
          class="navBox-bg"
          src="/static/images/icon-zdgl.png"
          mode="heightFix"
        ></image>
        <view class="content">
          <view class="label">入网管理</view>
          <view class="value">一键查看我的入网</view>
        </view>
      </view>
    </view>

    <image
      class="inviteImg"
      @click="navigateTo('/pages/home/upgradeAgent')"
	  src="/static/images/banner-yhy.png"
      mode="widthFix"
    />

    <view class="moreBox">
      <image class="img" src="/static/images/icon-xskt.png" @click="navigateTo('/pages/home/videoOperation')" mode="heightFix" />
      <image class="img" src="/static/images/icon-kfzx.png" mode="heightFix" />
    </view>

    <!-- 消息通知 -->
    <view class="noticeBox"  @click="navigateTo('/pages/my/notice')">
      <view class="noticeBox-in">
        <view class="noticeLabel"
          ><text>通知公告</text>
          <image
            class="notice-img"
            src="/static/images/icon-tzgg.png"
            mode="widthFix"
          ></image
        ></view>
        <u-notice-bar
          class="notice-bar"
          mode="vertical"
          type="none"
          padding="18rpx 0"
          :duration="4000"
          :volume-icon="false"
          :more-icon="false"
          :list="noticeList"
        >
        </u-notice-bar>
      </view>
    </view>
    <u-popup
      v-model="showPopup"
      mode="center"
      :closeable="closeable"
      width="96%"
      height="775rpx"
      :mask-close-able="false"
      close-icon-color="#ffffff"
      :contentStyle="{ backgroundColor: 'transparent' }"
      border-radius="20"
    >
      <view class="popup-content">
        <img class="popup-bg" src="/static/images/home-noticeBg.png" />
        <view class="main">
          <view class="main-in">
            <view class="title">- {{ popupData.title || '-' }} -</view>
            <view class="content">
              {{ popupData.intro || '-' }}
            </view>
            <view class="btn" @click="handleKnow">知道了</view>
          </view>
        </view>
      </view>
    </u-popup>
  </view>
</template>

<script>
import util from '@/common/utils.js';
import service from '@/common/service.js';

export default {
  data() {
    return {
      showPopup: false,
      noticeList: [],
      popupData: {
        title: '汇付天下上线普通版',
        intro:
          '汇付天下(普通版)预计15日下午开放采购，普通版机型政策依旧为:99+60+20+20+168;但值得注意的是，新下单机型低价费率为0.48%无分润(纯新客户无法享受，仅之前办理过汇付天下的，并已认证过本人特惠卡的老客户可以享受)，日常费率为0.6%(最高万8)，该版本机型虽然有返现，但也近期内不做任何费率上浮动作。',
      },
    };
  },
  onLoad(options) {
    this.getData();
  },
  methods: {
    getData() {},
    navigateTo(url) {
      uni.navigateTo({
        url: url,
      });
    },
    handleKnow(){
      this.showPopup = false;
    }
  },
};
</script>
<style lang="scss" scope>
.container {
  position: relative;
  width: 100%;
  min-height: 100vh;
  padding: 120rpx 30rpx 100rpx;
  background: #f5f5f5;
  box-sizing: border-box;
}

.bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: auto;
}

.header {
  position: relative;
  width: 100%;
  line-height: 1;
  .name {
    width: 100%;
    font-family: PingFang SC, sans-serif;
    font-weight: 800;
    font-size: 32rpx;
    color: #333333;
  }
  .time {
    margin-top: 10rpx;
    width: 100%;
    font-family: PingFang SC, sans-serif;
    font-weight: 400;
    font-size: 22rpx;
    color: #999999;
  }
}

.dataBox {
  position: relative;
  margin-top: 30rpx;
  width: 100%;
  .dataBox-bg {
    width: 100%;
    height: auto;
  }
  .dataBox-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 70rpx 30rpx 50rpx;
    line-height: 1;
    .header {
      width: 100%;
      .value {
        font-family: DIN, sans-serif;
        font-weight: bold;
        font-size: 48rpx;
        color: #ffeacc;
      }
      .label {
        margin-top: 10rpx;
        font-family: PingFang SC, sans-serif;
        font-weight: 400;
        font-size: 24rpx;
        color: rgba($color: #ffffff, $alpha: 0.5);
      }
    }
    .bottom {
      display: flex;
      justify-content: space-between;
      margin-top: 40rpx;
      .item {
        flex: 1;
        min-width: 0;
        .value {
          font-family: DIN, sans-serif;
          font-weight: bold;
          font-size: 32rpx;
          color: #ffeacc;
        }
        .label {
          margin-top: 10rpx;
          font-family: PingFang SC, sans-serif;
          font-weight: 400;
          font-size: 22rpx;
          color: rgba($color: #ffffff, $alpha: 0.5);
        }
      }
    }
  }
}

.navBox {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  position: relative;
  margin-top: 30rpx;
  width: 100%;
  .item {
    position: relative;
    margin-bottom: 15rpx;
    width: auto;
    height: 118rpx;
    .navBox-bg {
      width: auto;
      height: 118rpx;
    }
    .content {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      padding: 30rpx;
      line-height: 1;
      .label {
        font-family: PingFang SC, sans-serif;
        font-weight: 800;
        font-size: 28rpx;
        color: #333333;
      }

      .value {
        margin-top: 10rpx;
        font-family: PingFang SC, sans-serif;
        font-weight: 400;
        font-size: 22rpx;
        color: #999999;
      }
    }
  }
}

.inviteImg {
  margin-top: 20rpx;
  width: 100%;
  height: auto;
}

.moreBox {
  display: flex;
  justify-content: space-between;
  margin-top: 30rpx;
  width: 100%;
  .img {
    width: auto;
    height: 188rpx;
  }
}

.noticeBox {
  margin-top: 40rpx;
  width: 100%;
  padding: 0;
  .noticeBox-in {
    display: flex;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    width: 100%;
    padding: 0 30rpx;
    height: 70rpx;
    background: #ffffff;
    border-radius: 35rpx;
    .noticeLabel {
      position: relative;
      text {
        position: relative;
        font-family: PingFang SC, sans-serif;
        font-weight: 800;
        font-size: 28rpx;
        color: #333333;
        z-index: 9;
      }
      .notice-img {
        position: absolute;
        top: -10rpx;
        right: -16rpx;
        width: 32rpx;
        height: auto;
        z-index: 1;
      }
    }
    .notice-bar {
      flex: 1;
    }
  }
}

.popup-content {
  width: 100%;
  height: 100%;
  .popup-bg {
    width: 100%;
    height: 100%;
  }
  .main {
    position: absolute;
    top: 0;
    left: 0;
    padding: 271rpx 40rpx 30rpx;
    width: 100%;
    height: 100%;
    .main-in {
      position: relative;
      width: 100%;
      height: 100%;
      font-family: PingFang SC, sans-serif;
      .title {
        width: 100%;
        font-weight: bold;
        font-size: 36rpx;
        color: #333333;
        line-height: 1.5;
        text-align: center;
      }
      .content {
        margin-top: 30rpx;
        width: 100%;
        height: 279rpx;
        font-weight: 400;
        font-size: 28rpx;
        color: #333333;
        line-height: 1.5;
        text-align: left;
        overflow-y: auto;
      }
      .btn {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 100%;
        height: 88rpx;
        font-weight: bold;
        font-size: 32rpx;
        color: #ffffff;
        line-height: 88rpx;
        text-align: center;
        background: linear-gradient(90deg, #332108, #201403);
        border-radius: 16rpx;
      }
    }
  }
}
</style>
